

import java.awt.BorderLayout;

import javax.swing.JFrame;

import se.liu.oschi129.level.levelspace.LevelSpace;
import se.liu.oschi129.world.model.World;
import se.liu.oschi129.world.model.WorldTimer;
import se.liu.oschi129.world.model.WorldView;
import se.liu.oschi129.world.viewcontrol.WorldViewController;

/**
 * This is the Main class for Super Goomba World
 * 
 * @author johfa428, oschi129
 */
public class Main {

	public static void main(String[] args){
		// Load all resources
		new se.liu.johfa428.game.animationspace.GameAnimationSpace();
		new se.liu.oschi129.game.animationspace.GameAnimationSpace();
		new se.liu.johfa428.game.levelspace.GameLevelSpace();
		new se.liu.oschi129.game.levelspace.GameLevelSpace();
		new se.liu.oschi129.game.fontspace.GameFontSpace();
		
		// Create a frame
		JFrame frame = new JFrame("Goomba World");
		frame.setSize(640,480);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(new BorderLayout());

		// Create a world and load "level00_intro" into the world
		World world = new World(new WorldView(320,240));
		LevelSpace.get("level00_intro").createWorld(world, null);

		// Add a WorldViewController
		WorldViewController controller = new WorldViewController(world);
		frame.add(controller,BorderLayout.CENTER);
		
		// Shows the frame
		frame.setVisible(true);
		
		// Create a timer and schedule the WorldTimer to update the world.
		java.util.Timer t1 = new java.util.Timer();

		WorldTimer timer = new WorldTimer(world);
		t1.schedule(timer, 0, 40);
	}
}

